<?php
require_once("inc.member.php");

$this_title="$vars[member_title] &raquo; ".__("Placement Network");
$page_title=__("Placement Network");
$content_title=__("Placement Network");

require_once('inc.genealogy_tab.php');

//show member matrix
if($get_s["cur_uid"] && $get_s["cur_uid"]!=$head_info["code"]){
	$first_user = get_user_detail_by_code($get_s["cur_uid"]);
	$first_id = $first_user['id'];
}else{
	$first_id = $uid;
}

$user1 = get_user_detail_by_id($first_id);
$user2 = get_user_cf_by_upline_id($user1['id'],'1');
$user3 = get_user_cf_by_upline_id($user1['id'],'2');

if($user2['id']>0){
	$user4 = get_user_cf_by_upline_id($user2['id'],'1');
	$user5 = get_user_cf_by_upline_id($user2['id'],'2');
	
	if($user4['id']>0){
		$user8 = get_user_cf_by_upline_id($user4['id'],'1');
		$user9 = get_user_cf_by_upline_id($user4['id'],'2');
		
		if($user8['id']>0){
			$user16 = get_user_cf_by_upline_id($user8['id'],'1');
			$user17 = get_user_cf_by_upline_id($user8['id'],'2');		
		}
		if($user9['id']>0){
			$user18 = get_user_cf_by_upline_id($user9['id'],'1');
			$user19 = get_user_cf_by_upline_id($user9['id'],'2');		
		}
	}	
	if($user5['id']>0){
		$user10 = get_user_cf_by_upline_id($user5['id'],'1');
		$user11 = get_user_cf_by_upline_id($user5['id'],'2');
		
		if($user10['id']>0){
			$user20 = get_user_cf_by_upline_id($user10['id'],'1');
			$user21 = get_user_cf_by_upline_id($user10['id'],'2');		
		}
		if($user11['id']>0){
			$user22 = get_user_cf_by_upline_id($user11['id'],'1');
			$user23 = get_user_cf_by_upline_id($user11['id'],'2');		
		}
	}
}

if($user3['id']>0){
	$user6 = get_user_cf_by_upline_id($user3['id'],'1');
	$user7 = get_user_cf_by_upline_id($user3['id'],'2');
	
	if($user6['id']>0){
		$user12 = get_user_cf_by_upline_id($user6['id'],'1');
		$user13 = get_user_cf_by_upline_id($user6['id'],'2');
		
		if($user12['id']>0){
			$user24 = get_user_cf_by_upline_id($user12['id'],'1');
			$user25 = get_user_cf_by_upline_id($user12['id'],'2');		
		}
		if($user13['id']>0){
			$user26 = get_user_cf_by_upline_id($user13['id'],'1');
			$user27 = get_user_cf_by_upline_id($user13['id'],'2');		
		}
	}	
	if($user7['id']>0){
		$user14 = get_user_cf_by_upline_id($user7['id'],'1');
		$user15 = get_user_cf_by_upline_id($user7['id'],'2');
		
		if($user14['id']>0){
			$user28 = get_user_cf_by_upline_id($user14['id'],'1');
			$user29 = get_user_cf_by_upline_id($user14['id'],'2');		
		}
		if($user15['id']>0){
			$user30 = get_user_cf_by_upline_id($user15['id'],'1');
			$user31 = get_user_cf_by_upline_id($user15['id'],'2');		
		}
	}
}

$messaging = "
<table class='pbl_table'>
<tr class='pbl_header'>
	<td>Level</td><td>Account Info</td><td>Parent Level</td><td>Parent Player ID</td><td>Sponsor Player ID</td><td>Left CF</td><td>Right CF</td><td>Weekly Matched</td>
</tr>
<tr class='row0'>
	<td>1-1</td><td>".$user1['code']." - ".$user1['username']."</td><td></td><td>".$user1['placement']."</td><td>".$user1['sponsor']."</td><td>0</td><td>0</td><td>0/".($user1['max_wlot']+0)."</td>
</tr>
<tr class='row1'>
	<td>2-1</td><td>".(($user1['code']>0 && $user2['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user1['code']."&pos=1'>".__("[Register]")."</a>" : ($user2['code']<>''?($user2['code']." - ".$user2['username']):""))."</td><td>1-1</td></td><td>".$user2['placement']."</td><td>".$user2['sponsor']."</td><td>0</td><td>0</td><td>0/".($user2['max_wlot']+0)."</td>
</tr>
<tr class='row0'>
	<td>2-2</td><td>".(($user1['code']>0 && $user3['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user1['code']."&pos=2'>".__("[Register]")."</a>" : ($user3['code']<>''?($user3['code']." - ".$user3['username']):""))."</td><td>1-1</td></td><td>".$user3['placement']."</td><td>".$user3['sponsor']."</td><td>0</td><td>0</td><td>0/".($user3['max_wlot']+0)."</td>
</tr>
<tr class='row1'>
	<td>3-1</td><td>".(($user2['code']>0 && $user4['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user2['code']."&pos=1'>".__("[Register]")."</a>" : ($user4['code']<>''?($user4['code']." - ".$user4['username']):""))."</td><td>2-1</td></td><td>".$user4['placement']."</td><td>".$user4['sponsor']."</td><td>0</td><td>0</td><td>0/".($user4['max_wlot']+0)."</td>
</tr>
<tr class='row0'>
	<td>3-2</td><td>".(($user2['code']>0 && $user5['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user2['code']."&pos=2'>".__("[Register]")."</a>" : ($user5['code']<>''?($user5['code']." - ".$user5['username']):""))."</td><td>2-1</td></td><td>".$user5['placement']."</td><td>".$user5['sponsor']."</td><td>0</td><td>0</td><td>0/".($user5['max_wlot']+0)."</td>
</tr>
<tr class='row1'>
	<td>3-3</td><td>".(($user3['code']>0 && $user6['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user3['code']."&pos=1'>".__("[Register]")."</a>" : ($user6['code']<>''?($user6['code']." - ".$user6['username']):""))."</td><td>2-2</td></td><td>".$user6['placement']."</td><td>".$user6['sponsor']."</td><td>0</td><td>0</td><td>0/".($user6['max_wlot']+0)."</td>
</tr>
<tr class='row0'>
	<td>3-4</td><td>".(($user3['code']>0 && $user7['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user3['code']."&pos=2'>".__("[Register]")."</a>" : ($user7['code']<>''?($user7['code']." - ".$user7['username']):""))."</td><td>2-2</td></td><td>".$user7['placement']."</td><td>".$user7['sponsor']."</td><td>0</td><td>0</td><td>0/".($user7['max_wlot']+0)."</td>
</tr>
<tr class='row1'>
	<td>4-1</td><td>".(($user4['code']>0 && $user8['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user4['code']."&pos=1'>".__("[Register]")."</a>" : ($user8['code']<>''?($user8['code']." - ".$user8['username']):""))."</td><td>3-1</td></td><td>".$user8['placement']."</td><td>".$user8['sponsor']."</td><td>0</td><td>0</td><td>0/".($user8['max_wlot']+0)."</td>
</tr>
<tr class='row0'>
	<td>4-2</td><td>".(($user4['code']>0 && $user9['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user4['code']."&pos=2'>".__("[Register]")."</a>" : ($user9['code']<>''?($user9['code']." - ".$user9['username']):""))."</td><td>3-1</td></td><td>".$user9['placement']."</td><td>".$user9['sponsor']."</td><td>0</td><td>0</td><td>0/".($user9['max_wlot']+0)."</td>
</tr>
<tr class='row1'>
	<td>4-3</td><td>".(($user5['code']>0 && $user10['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user5['code']."&pos=1'>".__("[Register]")."</a>" : ($user10['code']<>''?($user10['code']." - ".$user10['username']):""))."</td><td>3-2</td></td><td>".$user10['placement']."</td><td>".$user10['sponsor']."</td><td>0</td><td>0</td><td>0/".($user10['max_wlot']+0)."</td>
</tr>
<tr class='row0'>
	<td>4-4</td><td>".(($user5['code']>0 && $user11['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user5['code']."&pos=2'>".__("[Register]")."</a>" : ($user11['code']<>''?($user11['code']." - ".$user11['username']):""))."</td><td>3-2</td></td><td>".$user11['placement']."</td><td>".$user11['sponsor']."</td><td>0</td><td>0</td><td>0/".($user11['max_wlot']+0)."</td>
</tr>
<tr class='row1'>
	<td>4-5</td><td>".(($user6['code']>0 && $user12['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user6['code']."&pos=1'>".__("[Register]")."</a>" : ($user12['code']<>''?($user12['code']." - ".$user12['username']):""))."</td><td>3-3</td></td><td>".$user12['placement']."</td><td>".$user12['sponsor']."</td><td>0</td><td>0</td><td>0/".($user12['max_wlot']+0)."</td>
</tr>
<tr class='row0'>
	<td>4-6</td><td>".(($user6['code']>0 && $user13['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user6['code']."&pos=2'>".__("[Register]")."</a>" : ($user13['code']<>''?($user13['code']." - ".$user13['username']):""))."</td><td>3-3</td></td><td>".$user13['placement']."</td><td>".$user13['sponsor']."</td><td>0</td><td>0</td><td>0/".($user13['max_wlot']+0)."</td>
</tr>
<tr class='row1'>
	<td>4-7</td><td>".(($user7['code']>0 && $user14['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user7['code']."&pos=1'>".__("[Register]")."</a>" : ($user14['code']<>''?($user14['code']." - ".$user14['username']):""))."</td><td>3-4</td></td><td>".$user14['placement']."</td><td>".$user14['sponsor']."</td><td>0</td><td>0</td><td>0/".($user14['max_wlot']+0)."</td>
</tr>
<tr class='row0'>
	<td>4-8</td><td>".(($user7['code']>0 && $user15['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user7['code']."&pos=2'>".__("[Register]")."</a>" : ($user15['code']<>''?($user15['code']." - ".$user15['username']):""))."</td><td>3-4</td></td><td>".$user15['placement']."</td><td>".$user15['sponsor']."</td><td>0</td><td>0</td><td>0/".($user15['max_wlot']+0)."</td>
</tr>
<tr class='row1'>
	<td>5-1</td><td>".(($user8['code']>0 && $user16['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user8['code']."&pos=1'>".__("[Register]")."</a>" : ($user16['code']<>''?($user16['code']." - ".$user16['username']):""))."</td><td>4-1</td></td><td>".$user16['placement']."</td><td>".$user16['sponsor']."</td><td>0</td><td>0</td><td>0/".($user16['max_wlot']+0)."</td>
</tr>
<tr class='row0'>
	<td>5-2</td><td>".(($user8['code']>0 && $user17['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user8['code']."&pos=2'>".__("[Register]")."</a>" : ($user17['code']<>''?($user17['code']." - ".$user17['username']):""))."</td><td>4-1</td></td><td>".$user17['placement']."</td><td>".$user17['sponsor']."</td><td>0</td><td>0</td><td>0/".($user17['max_wlot']+0)."</td>
</tr>
<tr class='row1'>
	<td>5-3</td><td>".(($user9['code']>0 && $user18['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user9['code']."&pos=1'>".__("[Register]")."</a>" : ($user18['code']<>''?($user18['code']." - ".$user18['username']):""))."</td><td>4-2</td></td><td>".$user18['placement']."</td><td>".$user18['sponsor']."</td><td>0</td><td>0</td><td>0/".($user18['max_wlot']+0)."</td>
</tr>
<tr class='row0'>
	<td>5-4</td><td>".(($user9['code']>0 && $user19['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user9['code']."&pos=2'>".__("[Register]")."</a>" : ($user19['code']<>''?($user19['code']." - ".$user19['username']):""))."</td><td>4-2</td></td><td>".$user19['placement']."</td><td>".$user19['sponsor']."</td><td>0</td><td>0</td><td>0/".($user19['max_wlot']+0)."</td>
</tr>
<tr class='row1'>
	<td>5-5</td><td>".(($user10['code']>0 && $user20['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user10['code']."&pos=1'>".__("[Register]")."</a>" : ($user20['code']<>''?($user20['code']." - ".$user20['username']):""))."</td><td>4-3</td></td><td>".$user20['placement']."</td><td>".$user20['sponsor']."</td><td>0</td><td>0</td><td>0/".($user20['max_wlot']+0)."</td>
</tr>
<tr class='row0'>
	<td>5-6</td><td>".(($user10['code']>0 && $user21['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user10['code']."&pos=2'>".__("[Register]")."</a>" : ($user21['code']<>''?($user21['code']." - ".$user21['username']):""))."</td><td>4-3</td></td><td>".$user21['placement']."</td><td>".$user21['sponsor']."</td><td>0</td><td>0</td><td>0/".($user21['max_wlot']+0)."</td>
</tr>
<tr class='row1'>
	<td>5-7</td><td>".(($user11['code']>0 && $user22['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user11['code']."&pos=1'>".__("[Register]")."</a>" : ($user22['code']<>''?($user22['code']." - ".$user22['username']):""))."</td><td>4-4</td></td><td>".$user22['placement']."</td><td>".$user22['sponsor']."</td><td>0</td><td>0</td><td>0/".($user22['max_wlot']+0)."</td>
</tr>
<tr class='row0'>
	<td>5-8</td><td>".(($user11['code']>0 && $user23['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user11['code']."&pos=2'>".__("[Register]")."</a>" : ($user23['code']<>''?($user23['code']." - ".$user23['username']):""))."</td><td>4-4</td></td><td>".$user23['placement']."</td><td>".$user23['sponsor']."</td><td>0</td><td>0</td><td>0/".($user23['max_wlot']+0)."</td>
</tr>
<tr class='row1'>
	<td>5-9</td><td>".(($user12['code']>0 && $user24['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user12['code']."&pos=1'>".__("[Register]")."</a>" : ($user24['code']<>''?($user24['code']." - ".$user24['username']):""))."</td><td>4-5</td></td><td>".$user24['placement']."</td><td>".$user24['sponsor']."</td><td>0</td><td>0</td><td>0/".($user24['max_wlot']+0)."</td>
</tr>
<tr class='row0'>
	<td>5-10</td><td>".(($user12['code']>0 && $user25['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user12['code']."&pos=2'>".__("[Register]")."</a>" : ($user25['code']<>''?($user25['code']." - ".$user25['username']):""))."</td><td>4-5</td></td><td>".$user25['placement']."</td><td>".$user25['sponsor']."</td><td>0</td><td>0</td><td>0/".($user25['max_wlot']+0)."</td>
</tr>
<tr class='row1'>
	<td>5-11</td><td>".(($user13['code']>0 && $user26['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user13['code']."&pos=1'>".__("[Register]")."</a>" : ($user26['code']<>''?($user26['code']." - ".$user26['username']):""))."</td><td>4-6</td></td><td>".$user26['placement']."</td><td>".$user26['sponsor']."</td><td>0</td><td>0</td><td>0/".($user26['max_wlot']+0)."</td>
</tr>
<tr class='row0'>
	<td>5-12</td><td>".(($user13['code']>0 && $user27['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user13['code']."&pos=2'>".__("[Register]")."</a>" : ($user27['code']<>''?($user27['code']." - ".$user27['username']):""))."</td><td>4-6</td></td><td>".$user27['placement']."</td><td>".$user27['sponsor']."</td><td>0</td><td>0</td><td>0/".($user27['max_wlot']+0)."</td>
</tr>
<tr class='row1'>
	<td>5-13</td><td>".(($user14['code']>0 && $user28['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user14['code']."&pos=1'>".__("[Register]")."</a>" : ($user28['code']<>''?($user28['code']." - ".$user28['username']):""))."</td><td>4-7</td></td><td>".$user28['placement']."</td><td>".$user28['sponsor']."</td><td>0</td><td>0</td><td>0/".($user28['max_wlot']+0)."</td>
</tr>
<tr class='row0'>
	<td>5-14</td><td>".(($user14['code']>0 && $user29['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user14['code']."&pos=2'>".__("[Register]")."</a>" : ($user29['code']<>''?($user29['code']." - ".$user29['username']):""))."</td><td>4-7</td></td><td>".$user29['placement']."</td><td>".$user29['sponsor']."</td><td>0</td><td>0</td><td>0/".($user29['max_wlot']+0)."</td>
</tr>
<tr class='row1'>
	<td>5-15</td><td>".(($user15['code']>0 && $user30['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user15['code']."&pos=1'>".__("[Register]")."</a>" : ($user30['code']<>''?($user30['code']." - ".$user30['username']):""))."</td><td>4-8</td></td><td>".$user30['placement']."</td><td>".$user30['sponsor']."</td><td>0</td><td>0</td><td>0/".($user30['max_wlot']+0)."</td>
</tr>
<tr class='row0'>
	<td>5-16</td><td>".(($user15['code']>0 && $user31['code']=='') ? "<a href='".$vars['file']['member']['register']."?upline=".$user15['code']."&pos=2'>".__("[Register]")."</a>" : ($user31['code']<>''?($user31['code']." - ".$user31['username']):""))."</td><td>4-8</td></td><td>".$user31['placement']."</td><td>".$user31['sponsor']."</td><td>0</td><td>0</td><td>0/".($user31['max_wlot']+0)."</td>
</tr>
</table>
";

$messaging1 = '		
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td width="1%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="1%">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="16" align="center"><img src="../image/rgicon.png"></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="16" align="center"><table border=1><tr><td colspan=2>'.__("Member ID").': '.$user1['code'].'<br>'.__("Username").': '.$user1['username'].'<br>'.__("Rank").': '.($user1['rank_a']? __($vars['rank_index_a_d'][$user1['rank_a']]) : __("None")).'</td></tr><tr><td width="50%">'.number_format($user2['amount']).'</td><td align=right width="50%">'.number_format($user3['amount']).'</td></tr></table></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="4">&nbsp;</td>
<td colspan="4" style="border-right:1mm solid #2284C6; border-bottom:1mm solid #2284C6">&nbsp;</td>
<td colspan="4" style="border-bottom:1mm solid #2284C6">&nbsp;</td>
<td colspan="4">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="4">&nbsp;</td>
<td colspan="4" style="border-left:1mm solid #2284C6">&nbsp;</td>
<td colspan="4" style="border-right:1mm solid #2284C6">&nbsp;</td>
<td colspan="4">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="8" align="center">'.($user2['id']? '<a href="'.$vars['file']['member']['network']."?cur_uid=".$user2['code'].'"><img src="../image/rgicon.png"></a>' : '<img src="../image/rgicon0.png">').'</td>
<td colspan="8" align="center">'.($user3['id']? '<a href="'.$vars['file']['member']['network']."?cur_uid=".$user3['code'].'"><img src="../image/rgicon.png"></a>' : '<img src="../image/rgicon0.png">').'</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="8" align="center"><table border=1><tr><td colspan=2>'.($user2['rank_a']? __("Member ID").': '.$user2['code'].'<br>'.__("Username").': '.$user2['username'].'<br>'.__("Rank").': '.__($vars['rank_index_a_d'][$user2['rank_a']])."" : ($user1['code']==''? __("Register") : "<a href='".$vars['file']['member']['register']."?upline=".$user1['code']."&pos=1'>".__("Register")."</a>")).'</td></tr><tr><td width="50%">'.number_format($user4['amount']).'</td><td align=right width="50%">'.number_format($user5['amount']).'</td></tr></table></td>
<td colspan="8" align="center"><table border=1><tr><td colspan=2>'.($user3['rank_a']? __("Member ID").': '.$user3['code'].'<br>'.__("Username").': '.$user3['username'].'<br>'.__("Rank").': '.__($vars['rank_index_a_d'][$user3['rank_a']])."" : ($user1['code']==''? __("Register") : "<a href='".$vars['file']['member']['register']."?upline=".$user1['code']."&pos=2'>".__("Register")."</a>")).'</td></tr><tr><td width="50%">'.number_format($user6['amount']).'</td><td align=right width="50%">'.number_format($user7['amount']).'</td></tr></table></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="2">&nbsp;</td>
<td colspan="2" style="border-right:1mm solid #2284C6; border-bottom:1mm solid #2284C6">&nbsp;</td>
<td colspan="2" style="border-bottom:1mm solid #2284C6">&nbsp;</td>
<td colspan="2">&nbsp;</td>
<td colspan="2">&nbsp;</td>
<td colspan="2" style="border-right:1mm solid #2284C6; border-bottom:1mm solid #2284C6">&nbsp;</td>
<td colspan="2" style="border-bottom:1mm solid #2284C6">&nbsp;</td>
<td colspan="2">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="2">&nbsp;</td>
<td colspan="2" style="border-left:1mm solid #2284C6">&nbsp;</td>
<td colspan="2" style="border-right:1mm solid #2284C6">&nbsp;</td>
<td colspan="2">&nbsp;</td>
<td colspan="2">&nbsp;</td>
<td colspan="2" style="border-left:1mm solid #2284C6">&nbsp;</td>
<td colspan="2" style="border-right:1mm solid #2284C6">&nbsp;</td>
<td colspan="2">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="4" align="center">'.($user4['id']? '<a href="'.$vars['file']['member']['network']."?cur_uid=".$user4['code'].'"><img src="../image/rgicon.png"></a>' : '<img src="../image/rgicon0.png">').'</td>
<td colspan="4" align="center">'.($user5['id']? '<a href="'.$vars['file']['member']['network']."?cur_uid=".$user5['code'].'"><img src="../image/rgicon.png"></a>' : '<img src="../image/rgicon0.png">').'</td>
<td colspan="4" align="center">'.($user6['id']? '<a href="'.$vars['file']['member']['network']."?cur_uid=".$user6['code'].'"><img src="../image/rgicon.png"></a>' : '<img src="../image/rgicon0.png">').'</td>
<td colspan="4" align="center">'.($user7['id']? '<a href="'.$vars['file']['member']['network']."?cur_uid=".$user7['code'].'"><img src="../image/rgicon.png"></a>' : '<img src="../image/rgicon0.png">').'</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="4" align="center"><table border=1><tr><td colspan=2>'.($user4['rank_a']? __("Member ID").': '.$user4['code'].'<br>'.__("Username").': '.$user4['username'].'<br>'.__("Rank").': '.__($vars['rank_index_a_d'][$user4['rank_a']])."" : ($user2['code']==''? __("Register") : "<a href='".$vars['file']['member']['register']."?upline=".$user2['code']."&pos=1'>".__("Register")."</a>")).'</td></tr><tr><td width="50%">'.number_format($user8['amount']).'</td><td align=right width="50%">'.number_format($user9['amount']).'</td></tr></table></td>
<td colspan="4" align="center"><table border=1><tr><td colspan=2>'.($user5['rank_a']? __("Member ID").': '.$user5['code'].'<br>'.__("Username").': '.$user5['username'].'<br>'.__("Rank").': '.__($vars['rank_index_a_d'][$user5['rank_a']])."" : ($user2['code']==''? __("Register") : "<a href='".$vars['file']['member']['register']."?upline=".$user2['code']."&pos=2'>".__("Register")."</a>")).'</td></tr><tr><td width="50%">'.number_format($user10['amount']).'</td><td align=right width="50%">'.number_format($user11['amount']).'</td></tr></table></td>
<td colspan="4" align="center"><table border=1><tr><td colspan=2>'.($user6['rank_a']? __("Member ID").': '.$user6['code'].'<br>'.__("Username").': '.$user6['username'].'<br>'.__("Rank").': '.__($vars['rank_index_a_d'][$user6['rank_a']])."" : ($user3['code']==''? __("Register") : "<a href='".$vars['file']['member']['register']."?upline=".$user3['code']."&pos=1'>".__("Register")."</a>")).'</td></tr><tr><td width="50%">'.number_format($user12['amount']).'</td><td align=right width="50%">'.number_format($user13['amount']).'</td></tr></table></td>
<td colspan="4" align="center"><table border=1><tr><td colspan=2>'.($user7['rank_a']? __("Member ID").': '.$user7['code'].'<br>'.__("Username").': '.$user7['username'].'<br>'.__("Rank").': '.__($vars['rank_index_a_d'][$user7['rank_a']])."" : ($user3['code']==''? __("Register") : "<a href='".$vars['file']['member']['register']."?upline=".$user3['code']."&pos=2'>".__("Register")."</a>")).'</td></tr><tr><td width="50%">'.number_format($user14['amount']).'</td><td align=right width="50%">'.number_format($user15['amount']).'</td></tr></table></td>
<td>&nbsp;</td>
</tr>

<tr>
<td>&nbsp;</td>
<td colspan="1">&nbsp;</td>
<td colspan="1" style="border-right:1mm solid #2284C6; border-bottom:1mm solid #2284C6">&nbsp;</td>
<td colspan="1" style="border-bottom:1mm solid #2284C6">&nbsp;</td>
<td colspan="1">&nbsp;</td>
<td colspan="1">&nbsp;</td>
<td colspan="1" style="border-right:1mm solid #2284C6; border-bottom:1mm solid #2284C6">&nbsp;</td>
<td colspan="1" style="border-bottom:1mm solid #2284C6">&nbsp;</td>
<td colspan="1">&nbsp;</td>
<td colspan="1">&nbsp;</td>
<td colspan="1" style="border-right:1mm solid #2284C6; border-bottom:1mm solid #2284C6">&nbsp;</td>
<td colspan="1" style="border-bottom:1mm solid #2284C6">&nbsp;</td>
<td colspan="1">&nbsp;</td>
<td colspan="1">&nbsp;</td>
<td colspan="1" style="border-right:1mm solid #2284C6; border-bottom:1mm solid #2284C6">&nbsp;</td>
<td colspan="1" style="border-bottom:1mm solid #2284C6">&nbsp;</td>
<td colspan="1">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="1">&nbsp;</td>
<td colspan="1" style="border-left:1mm solid #2284C6">&nbsp;</td>
<td colspan="1" style="border-right:1mm solid #2284C6">&nbsp;</td>
<td colspan="1">&nbsp;</td>
<td colspan="1">&nbsp;</td>
<td colspan="1" style="border-left:1mm solid #2284C6">&nbsp;</td>
<td colspan="1" style="border-right:1mm solid #2284C6">&nbsp;</td>
<td colspan="1">&nbsp;</td>
<td colspan="1">&nbsp;</td>
<td colspan="1" style="border-left:1mm solid #2284C6">&nbsp;</td>
<td colspan="1" style="border-right:1mm solid #2284C6">&nbsp;</td>
<td colspan="1">&nbsp;</td>
<td colspan="1">&nbsp;</td>
<td colspan="1" style="border-left:1mm solid #2284C6">&nbsp;</td>
<td colspan="1" style="border-right:1mm solid #2284C6">&nbsp;</td>
<td colspan="1">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="2" align="center">'.($user8['id']? '<a href="'.$vars['file']['member']['network']."?cur_uid=".$user8['code'].'"><img src="../image/rgicon.png"></a>' : '<img src="../image/rgicon0.png">').'</td>
<td colspan="2" align="center">'.($user9['id']? '<a href="'.$vars['file']['member']['network']."?cur_uid=".$user9['code'].'"><img src="../image/rgicon'.($matrix['lvl2_2']=='0'?"0":"").'.png"></a>' : '<img src="../image/rgicon0.png">').'</td>
<td colspan="2" align="center">'.($user10['id']? '<a href="'.$vars['file']['member']['network']."?cur_uid=".$user10['code'].'"><img src="../image/rgicon'.($matrix['lvl2_3']=='0'?"0":"").'.png"></a>' : '<img src="../image/rgicon0.png">').'</td>
<td colspan="2" align="center">'.($user11['id']? '<a href="'.$vars['file']['member']['network']."?cur_uid=".$user11['code'].'"><img src="../image/rgicon'.($matrix['lvl2_4']=='0'?"0":"").'.png"></a>' : '<img src="../image/rgicon0.png">').'</td>
<td colspan="2" align="center">'.($user12['id']? '<a href="'.$vars['file']['member']['network']."?cur_uid=".$user12['code'].'"><img src="../image/rgicon'.($matrix['lvl2_1']=='0'?"0":"").'.png"></a>' : '<img src="../image/rgicon0.png">').'</td>
<td colspan="2" align="center">'.($user13['id']? '<a href="'.$vars['file']['member']['network']."?cur_uid=".$user13['code'].'"><img src="../image/rgicon'.($matrix['lvl2_2']=='0'?"0":"").'.png"></a>' : '<img src="../image/rgicon0.png">').'</td>
<td colspan="2" align="center">'.($user14['id']? '<a href="'.$vars['file']['member']['network']."?cur_uid=".$user14['code'].'"><img src="../image/rgicon'.($matrix['lvl2_3']=='0'?"0":"").'.png"></a>' : '<img src="../image/rgicon0.png">').'</td>
<td colspan="2" align="center">'.($user15['id']? '<a href="'.$vars['file']['member']['network']."?cur_uid=".$user15['code'].'"><img src="../image/rgicon'.($matrix['lvl2_4']=='0'?"0":"").'.png"></a>' : '<img src="../image/rgicon0.png">').'</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="2" align="center"><table border=1><tr><td colspan=2>'.($user8['rank_a']? __("Member ID").': '.$user8['code'].'<br>'.__("Username").': '.$user8['username'].'<br>'.__("Rank").': '.__($vars['rank_index_a_d'][$user8['rank_a']])."" : ($user4['code']==''? __("Register") : "<a href='".$vars['file']['member']['register']."?upline=".$user4['code']."&pos=1'>".__("Register")."</a>")).'</td></tr><tr><td width="50%">'.number_format($user16['amount']).'</td><td align=right width="50%">'.number_format($user17['amount']).'</td></tr></table></td>
<td colspan="2" align="center"><table border=1><tr><td colspan=2>'.($user9['rank_a']? __("Member ID").': '.$user9['code'].'<br>'.__("Username").': '.$user9['username'].'<br>'.__("Rank").': '.__($vars['rank_index_a_d'][$user9['rank_a']])."" : ($user4['code']==''? __("Register") : "<a href='".$vars['file']['member']['register']."?upline=".$user4['code']."&pos=2'>".__("Register")."</a>")).'</td></tr><tr><td width="50%">'.number_format($user18['amount']).'</td><td align=right width="50%">'.number_format($user19['amount']).'</td></tr></table></td>
<td colspan="2" align="center"><table border=1><tr><td colspan=2>'.($user10['rank_a']? __("Member ID").': '.$user10['code'].'<br>'.__("Username").': '.$user10['username'].'<br>'.__("Rank").': '.__($vars['rank_index_a_d'][$user10['rank_a']])."" : ($user5['code']==''? __("Register") : "<a href='".$vars['file']['member']['register']."?upline=".$user5['code']."&pos=1'>".__("Register")."</a>")).'</td></tr><tr><td width="50%">'.number_format($user20['amount']).'</td><td align=right width="50%">'.number_format($user21['amount']).'</td></tr></table></td>
<td colspan="2" align="center"><table border=1><tr><td colspan=2>'.($user11['rank_a']? __("Member ID").': '.$user11['code'].'<br>'.__("Username").': '.$user11['username'].'<br>'.__("Rank").': '.__($vars['rank_index_a_d'][$user11['rank_a']])."" : ($user5['code']==''? __("Register") : "<a href='".$vars['file']['member']['register']."?upline=".$user5['code']."&pos=2'>".__("Register")."</a>")).'</td></tr><tr><td width="50%">'.number_format($user22['amount']).'</td><td align=right width="50%">'.number_format($user23['amount']).'</td></tr></table></td>
<td colspan="2" align="center"><table border=1><tr><td colspan=2>'.($user12['rank_a']? __("Member ID").': '.$user12['code'].'<br>'.__("Username").': '.$user12['username'].'<br>'.__("Rank").': '.__($vars['rank_index_a_d'][$user12['rank_a']])."" : ($user6['code']==''? __("Register") : "<a href='".$vars['file']['member']['register']."?upline=".$user6['code']."&pos=1'>".__("Register")."</a>")).'</td></tr><tr><td width="50%">'.number_format($user24['amount']).'</td><td align=right width="50%">'.number_format($user25['amount']).'</td></tr></table></td>
<td colspan="2" align="center"><table border=1><tr><td colspan=2>'.($user13['rank_a']? __("Member ID").': '.$user13['code'].'<br>'.__("Username").': '.$user13['username'].'<br>'.__("Rank").': '.__($vars['rank_index_a_d'][$user13['rank_a']])."" : ($user6['code']==''? __("Register") : "<a href='".$vars['file']['member']['register']."?upline=".$user6['code']."&pos=2'>".__("Register")."</a>")).'</td></tr><tr><td width="50%">'.number_format($user26['amount']).'</td><td align=right width="50%">'.number_format($user27['amount']).'</td></tr></table></td>
<td colspan="2" align="center"><table border=1><tr><td colspan=2>'.($user14['rank_a']? __("Member ID").': '.$user14['code'].'<br>'.__("Username").': '.$user14['username'].'<br>'.__("Rank").': '.__($vars['rank_index_a_d'][$user14['rank_a']])."" : ($user7['code']==''? __("Register") : "<a href='".$vars['file']['member']['register']."?upline=".$user7['code']."&pos=1'>".__("Register")."</a>")).'</td></tr><tr><td width="50%">'.number_format($user28['amount']).'</td><td align=right width="50%">'.number_format($user29['amount']).'</td></tr></table></td>
<td colspan="2" align="center"><table border=1><tr><td colspan=2>'.($user15['rank_a']? __("Member ID").': '.$user15['code'].'<br>'.__("Username").': '.$user15['username'].'<br>'.__("Rank").': '.__($vars['rank_index_a_d'][$user15['rank_a']])."" : ($user7['code']==''? __("Register") : "<a href='".$vars['file']['member']['register']."?upline=".$user7['code']."&pos=2'>".__("Register")."</a>")).'</td></tr><tr><td width="50%">'.number_format($user30['amount']).'</td><td align=right width="50%">'.number_format($user31['amount']).'</td></tr></table></td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>';

$matrix="
<p style='color:#FFF;margin-left:16px;margin-top:8px;font-size:15px; height:30px;'>".__("Go to the network of member ID:")."<select name='cur_uid' id='cur_uid' onchange=\"window.location='$this_file?cur_uid='+document.getElementById('cur_uid').value;\" >".get_placement_downline($uid, $_GET['cur_uid'])."</select>&nbsp;<button type='button' onclick=\"window.location='$this_file?cur_uid='+".get_left_code($user1['code']).";\" >".__('Bottom Left')."</button>&nbsp;<button type='button' onclick=\"window.location='$this_file?cur_uid='+".get_right_code($user1['code']).";\" >".__('Bottom Right')."</button></p>$messaging";
/*<br />\n
".__("Sponsor ID:")." ".($r_user["ref"]? $r_user["ref"] : __("None"))."<br />\n
".__("Upline ID:")." ".($r_user["matrix_upline"]? $r_user["matrix_upline"]." ".__("Position").__(":")." ".$r_user["matrix_position"] : __("None"))."</p>
$matrix";*/

$matrix=str_replace("<%tab_content%>", $matrix, $tab);
$content=$matrix;
//$content="<h2>$page_title</h2>$matrix";
//$content=str_replace("<%tab_content%>", $content, $tab);

print format_member_page($content, $this_title, $content_title, $css);
?>